

package laboratorio;


public class ComplexOperations {
    private Object dato;
    private Object dato2;
    
    public ComplexOperations(){     
    }
    
     public ComplexOperations(Object dat, Object dat2){
         dato=dat;
         dato2=dat2;
    }

     public Object getDato () {
        return dato;
    }
    
    public void setDato (Object val) {
        this.dato = val;
    }
    
     public Object getDato2 () {
        return dato2;
        
    }
    
    public void setDato2 (Object val) {
        this.dato2 = val;
    }

    public Object sum(Object a, Object b) {
       Complex c= new Complex();

        //throw new UnsupportedOperationException("Not supported yet.");

         return  c.suma((Complex)a, (Complex)b);
    }


    /*

    public Object sum(){
        int a=Integer.parseInt(dato[0].toString());        
        int b=Integer.parseInt(dato[1].toString());
        int c=Integer.parseInt(dato2[0].toString());        
        int d=Integer.parseInt(dato2[1].toString());
        Complex sum=new Complex();
        sum.suma(a,b, c, d);
        Object aux[];
        aux=new Object[1];
        aux[0]=sum.getReal();
        aux[1]=sum.getIma();
        
        return aux[0];
    }

    public Object substraction(){
        int a=Integer.parseInt(dato[0].toString());        
        int b=Integer.parseInt(dato[1].toString());
        int c=Integer.parseInt(dato2[0].toString());        
        int d=Integer.parseInt(dato2[1].toString());
        Object aux[];
        aux=new Object[1];
        aux[0]=a-c;
        aux[1]=b-d;
        
        return aux;
    }

    public Object mult(){
        int a=Integer.parseInt(dato[0].toString());        
        int b=Integer.parseInt(dato[1].toString());
        int c=Integer.parseInt(dato2[0].toString());        
        int d=Integer.parseInt(dato2[1].toString());
        Object aux[];
        aux=new Object[1];
        aux[0]=(a*c)-(b*d);
        aux[1]=(a*d)+(c*b);
        
        return aux;
    }

    public Object div(){
        //if(dato2==0){return-1 ;}
        
        int a=Integer.parseInt(dato[0].toString());        
        int b=Integer.parseInt(dato[1].toString());
        int c=Integer.parseInt(dato2[0].toString());        
        int d=Integer.parseInt(dato2[1].toString());
        Object aux[];
        aux=new Object[1];
        aux[0]=((a*c)-(b*d))/(c^2+d^2);
        aux[1]=(c*b)-(a*d)/(c^2+d^2);
        
        return aux[0];
    }
*/
    
    public Object substraction(Object a, Object b) {
       Complex c= new Complex();

        //throw new UnsupportedOperationException("Not supported yet.");

         return  c.resta((Complex)a, (Complex)b);
    }
    
    public Object mult(Object a, Object b) {
       Complex c= new Complex();

        //throw new UnsupportedOperationException("Not supported yet.");

         return  c.multiplicacion((Complex)a, (Complex)b);
    }
    
    public Object div(Object a, Object b) {
       Complex c= new Complex();

        //throw new UnsupportedOperationException("Not supported yet.");

         return  c.division((Complex)a, (Complex)b);
    }
    
    
}
